package com.hqd.ch03.v51.utils.concurrent;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;

class DelegatingCompletableFuture<T> extends CompletableFuture<T> {

    private final Future<T> delegate;


    public DelegatingCompletableFuture(Future<T> delegate) {
        this.delegate = delegate;
    }


    @Override
    public boolean cancel(boolean mayInterruptIfRunning) {
        boolean result = this.delegate.cancel(mayInterruptIfRunning);
        super.cancel(mayInterruptIfRunning);
        return result;
    }

}
